﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NextObj : MonoBehaviour {
    public static NextObj s_Instance;
    public MoveObj m_MoveObjPrefab;
    public MoveObj m_MoveObjNow;
    public List<Block> m_BlockList = new List<Block>(8);
	// Use this for initialization
	void Awake () {
        s_Instance = this;
    }
    private void Start() {
        FreshOneMoveObj();
    }
    // Update is called once per frame

    public void FreshOneMoveObj() {
        if (m_MoveObjNow != null) {
            Destroy(m_MoveObjNow.gameObject);
        }
        m_MoveObjNow = Instantiate(m_MoveObjPrefab) as MoveObj;
        m_MoveObjNow.InitType();
        foreach(var item in m_BlockList) {
            item.DeLight();
        }
        foreach(var item in m_MoveObjNow.m_PosList) {
            int x = 0;
            if (item.x > 0) {
                x = 4;
            }
            m_BlockList[x + (int)item.y].HighLight(m_MoveObjNow.m_ObjType);
        }
    }
}
